import http from 'jax-node/utils/http'

// 登录
export function login(data) {
  return http({
    url: '/login',
    method: 'post',
    data: data,
    needLogin: false,
  })
}

// 退出
export function logout() {
  return http({
    url: '/logout',
    method: 'post',
    needLogin: false,
  })
}

// 获取用户信息
export function getUserInfo() {
  return http({
    url: '/system/user/info',
  })
}

// 首页数据
export function home(query) {
  return http({
    url: '/system/home',
    params: query,
  })
}

// 获取配置
export function getSetting() {
  return http({
    url: '/system/setting',
    needLogin: false,
  })
}

// 字典
export function getDict() {
  return http({
    url: '/system/config/dict',
    needLogin: false,
  })
}

// 获取登录用户菜单
export const getUserMenu = query => {
  return http({
    url: '/system/menu/route',
    params: query,
  })
}

export default { login, getUserInfo, home, logout, setting: getSetting, getDict }
